/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package datos;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author monica
 */
@Entity
@Table(name = "detalleProgramacion")
@NamedQueries({@NamedQuery(name = "DetalleProgramacion.findAll", query = "SELECT d FROM DetalleProgramacion d"),
@NamedQuery(name = "DetalleProgramacion.findById", query = "SELECT d FROM DetalleProgramacion d WHERE d.id = :id"),
@NamedQuery(name = "DetalleProgramacion.findByPeriodo", query = "SELECT d FROM DetalleProgramacion d WHERE d.periodo = :periodo"),
@NamedQuery(name = "DetalleProgramacion.findByAvancePrevisto", query = "SELECT d FROM DetalleProgramacion d WHERE d.avancePrevisto = :avancePrevisto"),
@NamedQuery(name = "DetalleProgramacion.findByAvanceReal", query = "SELECT d FROM DetalleProgramacion d WHERE d.avanceReal = :avanceReal"),
@NamedQuery(name = "DetalleProgramacion.findByMontoPrevisto", query = "SELECT d FROM DetalleProgramacion d WHERE d.montoPrevisto = :montoPrevisto"),
@NamedQuery(name = "DetalleProgramacion.findByMontoReal", query = "SELECT d FROM DetalleProgramacion d WHERE d.montoReal = :montoReal"),
@NamedQuery(name = "DetalleProgramacion.encontrarPorProgramacion", query = "SELECT d FROM DetalleProgramacion d WHERE d.idProgramacion.id = :idProgramacion ORDER BY d.id ASC"),
@NamedQuery(name = "DetalleProgramacion.encontrarPorObra", query = "SELECT d FROM DetalleProgramacion d WHERE d.idProgramacion.idObra.id = :idObra AND d.idProgramacion.idObra.eliminada = 0"),
@NamedQuery(name = "DetalleProgramacion.findByRetraso", query = "SELECT d FROM DetalleProgramacion d WHERE d.retraso = :retraso")})
public class DetalleProgramacion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "periodo")
    private String periodo;
    @Basic(optional = false)
    @Column(name = "avancePrevisto")
    private float avancePrevisto;
    @Column(name = "avanceReal")
    private Float avanceReal;
    @Basic(optional = false)
    @Column(name = "montoPrevisto")
    private BigDecimal montoPrevisto;
    @Column(name = "montoReal")
    private BigDecimal montoReal;
    @Lob
    @Column(name = "alerta")
    private String alerta;
    @Column(name = "retraso")
    private Float retraso;
    @JoinColumn(name = "idProgramacion", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Programacion idProgramacion;

    public DetalleProgramacion() {
    }

    public DetalleProgramacion(Integer id) {
        this.id = id;
    }

    public DetalleProgramacion(Integer id, String periodo, float avancePrevisto, BigDecimal montoPrevisto) {
        this.id = id;
        this.periodo = periodo;
        this.avancePrevisto = avancePrevisto;
        this.montoPrevisto = montoPrevisto;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPeriodo() {
        return periodo;
    }

    public void setPeriodo(String periodo) {
        this.periodo = periodo;
    }

    public float getAvancePrevisto() {
        return avancePrevisto;
    }

    public void setAvancePrevisto(float avancePrevisto) {
        this.avancePrevisto = avancePrevisto;
    }

    public Float getAvanceReal() {
        return avanceReal;
    }

    public void setAvanceReal(Float avanceReal) {
        this.avanceReal = avanceReal;
    }

    public BigDecimal getMontoPrevisto() {
        return montoPrevisto;
    }

    public void setMontoPrevisto(BigDecimal montoPrevisto) {
        this.montoPrevisto = montoPrevisto;
    }

    public BigDecimal getMontoReal() {
        return montoReal;
    }

    public void setMontoReal(BigDecimal montoReal) {
        this.montoReal = montoReal;
    }

    public String getAlerta() {
        return alerta;
    }

    public void setAlerta(String alerta) {
        this.alerta = alerta;
    }

    public Float getRetraso() {
        return retraso;
    }

    public void setRetraso(Float retraso) {
        this.retraso = retraso;
    }

    public Programacion getIdProgramacion() {
        return idProgramacion;
    }

    public void setIdProgramacion(Programacion idProgramacion) {
        this.idProgramacion = idProgramacion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetalleProgramacion)) {
            return false;
        }
        DetalleProgramacion other = (DetalleProgramacion) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "datos.DetalleProgramacion[id=" + id + "]";
    }

}
